<?php
/**
 * Created by PhpStorm.
 * User: *!N.J
 * Date: 2021/9/26
 * Time: 12:51
 * QQ:1467572213
 */

namespace app\agent\model;

use think\Db;
use think\facade\Config;
use think\Model;

class Recharge extends Model
{
    public static function recharge_list($keyword,$agent_id)
    {
//        $where['pid'] = $agent_id;
//        $where['status'] = 1;
        if ($keyword){
            $list = Db::name('fd_recharge')
//                ->where($where)
                ->where('username',$keyword)
                ->order('id','desc')
                ->paginate(10,false,['query'=>request()->param()]);
            return $list;
        }else{
            $list = Db::name('fd_recharge')
//                ->where($where)
                ->order('id','desc')
                ->paginate(10,false,['query'=>request()->param()]);
            return $list;
        }
    }

    public static function sum($keyword,$agent_id)
    {
        $where['pid'] = $agent_id;
        $where['username'] = $keyword;
        $where['status'] = 1;
        $sum = Db::name('fd_recharge')->where($where)->sum('money');
        return $sum;
    }

}